package com.redlight.token.valid;

import com.redlight.base.SysUser;
import com.redlight.base.SysUserRel;
import com.redlight.exception.OauthTokenException;
import com.redlight.jdbc.JdbcParam;
import com.redlight.jdbc.JdbcUtil;
import com.redlight.token.LoginPara;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chao
 * @Title: OauthTokenValid
 * @date 2019-01-24 21:35
 */
public abstract class OauthTokenValid {
    public OauthTokenValid() {
    }

    public abstract SysUser valid(LoginPara var1) throws OauthTokenException;

    public abstract SysUser getUserByLoginName(String var1);

    public abstract SysUser getUserById(String var1);

    public final List<SysUserRel> getSysUserRel(String userId) {
        String sqlField = "id,user_id,sys,user_id2,login_name,name,sex_code,sex_label,dept_code,dept_label,job_code,job_label,mobile,tel,email,professional,enable";
        String sql = "select " + sqlField + " from t_sys_user_rel where user_id=?";
        JdbcParam jdbcParam = new JdbcParam(userId, String.class);
        Object list = new ArrayList();

        try {
            list = JdbcUtil.queryList(sql, jdbcParam, SysUserRel.class);
        } catch (Exception var7) {
            var7.printStackTrace();
        }

        return (List)list;
    }
}
